<template>
  <div class="">
    <Index2 />
    <el-divider />
    <MyPie :salePie="salePie" />
    <el-divider />
    <MyMap :saleMap="saleMap" />
  </div>
</template>

<script lang="ts" setup>
import Index2 from './components/Index2.vue'
import { home } from '@/request/api'
import { reactive, toRefs } from 'vue'
import MyPie from './components/MyPie.vue'
import MyMap from './components/MyMap.vue'

const data: {
  saleMap: ISaleMapModel[]
  salePie: ISalePieModel[]
} = reactive({
  // 地图数据
  saleMap: [],
  // 饼图数据
  salePie: [],
})
const { saleMap, salePie } = toRefs(data)
// 获取 饼图 和 地图 数据
home.APIAdminStat().then((res) => {
  // console.log(res)
  if (res.errno === 0) {
    salePie.value = res.data.salePie
    saleMap.value = res.data.saleMap
  }
})
</script>

<style lang="less" scoped></style>
